#ifndef __TILE_H_
#define __TILE_H_
#include "SDL/SDL.h"
#include <string>
#include <iostream>
#include <sstream>
#include "SDL/SDL_mixer.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_image.h"

using namespace std;

//小圆点
class Tile
{
private:
    #define TILE_RAW_COUNT 3
    #define TILE_CAL_COUNT 3
    #define TILE_HEIGHT 80
    #define TILE_WIDTH 80
    //圆点的X，Y坐标
    int x, y;
    //圆点分别在X，Y方向上的速度分量
    int xVel, yVel;

    SDL_Surface *background;
    void setClips();
    SDL_Rect clips[TILE_RAW_COUNT*TILE_CAL_COUNT];
    int nowFrameIndex;
    SDL_Surface *loadImage( string filename );
    string filename;
    SDL_Rect *camera;

#define GRID_RAW 30
#define GRID_CAL 30
    int grid[GRID_RAW][GRID_CAL];

public:

    //初始化变量
    Tile();
    ~Tile();
    
    //溜圆点函数
    void move();
    
    //溜圆点背景图
    void setBackground( string filename );
    
    //显示原点
    void updateDraw(SDL_Surface *screen);


    //溜圆点位置
    void setPos(int x, int y);
    void getPos(int &x, int &y);

    //调整pos位置到指定框内
    void adaptPos(int w, int h);
    //设置相机位置
    void setCamera(SDL_Rect *camera);
};

#endif //__TILE_H_